Silk Mobile

Table of Contents (Homepage)

Drag Coordinates

void DragCoordinates(X1, Y1, X2, Y2, Time)

images/images/os-icons/os_ios_150x150.png

images/images/os-icons/os_android_150x150.png

images/images/os-icons/os_windows_150x150.png

images/images/os-icons/os_blackberry_150x150.png

images/images/os-icons/os_symbian02_150x150.png

images/images/os-icons/os_windows_mobile_150x150.png

Description

Command to perform drag action based on start coordinates (X,Y) and end coordinates (X,Y) on the device reflection.

Parameters

Drag base on coordinates

  • int X1: X coordinate starting point of where you want to start the drag

  • int Y1: Y coordinate starting point of where you want to start the drag

  • int X2: X coordinate starting point of where you want to end the drag

  • int Y2: Y coordinate starting point of where you want to end the drag

  • int Time: Time for the command to be executed (in milliseconds)

Note: You can use the p2cx p2cy commands [links] for absolute values not depend on a specific device.

Usage

Scenario: In the following example, we will use the dragCoordinates to drag the safari icon to the dock of the screen.

  1. Before Dragging the application, screen will look like this:

    images/download/attachments/3309848/13.jpg
  2. Perform a continuous click on the Safari icon to make it draggable.

  3. Run the command with the following values:

    Parameters set to:

    • x1 - 636

    • y1 - 826

    • x2 - 572

    • y2 - 1166

    • time - 2000

    These values were pull from the debug tab. For more information, see Width/Height .
    images/download/attachments/3309848/14.jpg images/download/attachments/3309848/15.jpg
    Result after command ends:
    images/download/attachments/3309848/16.jpg

Code Examples

Java Example
client.dragCoordinates(636, 826, 572, 1166, 2000);
C# Example
client.DragCoordinates(636, 826, 572, 1166, 2000);
VBScript Example
client.DragCoordinates 636, 826, 572, 1166, 2000
Python Example
self.client.dragCoordinates2(636, 826, 572, 1166, 2000)
Perl Example
$client->dragCoordinates2(636, 826, 572, 1166, 2000);